package tresp.utils.logging;

import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;


/**
 * 
 * <b>MyLogger</b>
 * 
 * 
 * 
 * @author<font color="blue">Maxim Kirilov</font>
 *
 */
public class MyLogger {

//    private static FileHandler fh = null;
    
    private static ConsoleHandler ch = null;
    
    static{
	ch = new ConsoleHandler();
	ch.setFormatter( new SimpleFormatter() );
/*	
	try {
	     fh = new FileHandler("logs\\AgentRobot.log",false);
	     fh.setFormatter( new SimpleFormatter() );
	} catch (SecurityException e) {
	} catch (IOException e) {}
*/
	
    }
    
    
    public static Logger getLogger(String name){
	Logger logger = Logger.getLogger( name );
	logger.setLevel( Level.INFO );
	logger.addHandler( ch );
//	logger.addHandler( fh );
	logger.setUseParentHandlers(false);
	return logger;
    }
    
    public static Logger getLogger(Class<?> clazz){
	return getLogger ( clazz.getName() );
    }
    
}
